public class projectContentController {

    public projectContentController(ApexPages.StandardController controller) {
        
        curRef = ApexPages.currentPage().getParameters().get('curRef');
        file   = new ContentVersion(project__c = curRef);
    }
    
    public ContentVersion file { get; set; }
    public string curRef { get; set; }
    
    
    public PageReference go() {
        PageReference pr = new PageReference('/apex/tcloser?curRef='+curRef);
        if(curRef != Null){
           
            ContentWorkspace cw =  [SELECT Id, Name FROM ContentWorkspace WHERE name='Projects' limit 1];
            file.project__c = curRef;           
            file.FirstPublishLocationId = cw.id;
        }
        
        try{
        insert file;
        pr.setRedirect(true); 
        }catch (Exception e) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Unable to Upload file :'+e));
            pr = null;
        } 
        
        return pr;
    }
    //Test methods
    static testMethod  void projectContentControllerTest1() {
      //start test
     //test.starttest();
       //create controller object instance to test against
        ApexPages.StandardController con = new ApexPages.StandardController(new ContentVersion());               
        projectContentController Ctlr = new projectContentController(con);
        
        blob b = blob.valueof('file');
        Ctlr.file.title='TESTMETHOD';
        Ctlr.file.PathOnClient='test.pdf';
        Ctlr.file.VersionData = b;
        Ctlr.go();
           
       // end the test
     //test.stoptest();  
   } 

}